(function ($) {

    /*自定义插件的编写*/
    $.fn.scrollList = function (options) {
        var obj = options ? options : {};
        var limit = obj.limit ? obj.limit : 4;
        var speed = obj.speed ? obj.speed : 3000;
        var type = obj.type ? obj.type : 0;

        console.log(limit);
        console.log(speed);
        console.log(this);
        var that = $(this);
        console.log(that);
        var item = that.children().first();
        var itemHight = item.outerHeight() + parseFloat(item.css("margin-top")) + parseFloat(item.css("margin-bottom"));
        console.log(itemHight);
        that.height(itemHight * limit);
        switch (type) {
            case 1:
                /*动画type:1*/
                setInterval(function () {
                    that.children().last().fadeOut(500).prependTo(that).slideDown(500).fadeTo(500,1);
                    // console.log(item)
                }, speed)
                break;
            case 2:
                /*动画type:2*/

                setInterval(function () {

                    that.children().last().fadeOut(500,function () {
                        that.children().last().prependTo(that).fadeIn(500)
                    })

                    that.children()
                    // console.log(item)
                }, speed)
                break;
            default:
                /*默认动画type:0*/
                setInterval(function () {
                    that.children().last().hide().prependTo(that).slideDown(500);
                    // console.log(item)
                }, speed)
                break;
        }


    }

})(jQuery)